public class unsafe_counter implements I {
  private int count = 0;

  @Override
  public void bar() {
    // Read
    int tmp = count;

    // Simulate time-consuming operations to increase the probability of
    // concurrent conflicts.
    try {
      Thread.sleep(1);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }

    // Write
    count = tmp + 1;
  }

  public int get_counter() { return count; }
}